package net.esj.basic.dao.jdbc.impl;

import java.util.List;

import net.esj.basic.dao.DaoSupport;
import net.esj.basic.dao.QueryBuilderDao;
import net.esj.basic.dao.jdbc.JdbcQueryBuilder;
import net.esj.basic.dao.jdbc.JdbcSqlUtils;
import net.esj.basic.dao.querybuilder.QueryBuilder;
import net.esj.basic.utils.Pagination;
import net.melon.jdbc.JdbcTemplate;

public class JdbcQueryBuilderDaoImpl extends DaoSupport<JdbcTemplate> implements QueryBuilderDao {

	@Override
	public int queryCountByQueryBuilder(QueryBuilder qb) {
		String sql = (String) qb.invoke();
		sql = JdbcSqlUtils.generateSelectCountSql(sql);
		int count = getSupportSource().queryForInt(JdbcSqlUtils.generateSelectCountSql(sql));
		return count;
	}

	@Override
	public List queryListByQueryBuilder(QueryBuilder qb) {
		
		return null;
	}

	@Override
	public Pagination queryPageByQueryBuilder(Pagination page) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List queryTopByQueryBuilder(QueryBuilder qb, int count) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object queryFirst(QueryBuilder qb) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public QueryBuilder getQueryBuilder(Class clazz) {
		return JdbcQueryBuilder.forClass(clazz);
	}

	@Override
	public Long queryMaxByQueryBuilder(QueryBuilder qb, String key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long querySumByQueryBuilder(QueryBuilder qb, String key) {
		// TODO Auto-generated method stub
		return null;
	}

}
